package com.ruoyi.system.domain.enums;

import lombok.Getter;

@Getter
public enum TaskTypeEnum {
    DATA_PUSH(1, "数据推送"),
    DATA_UPDATE(2, "数据更新"),
    APP_INSTALL(3, "应用安装"),
    APP_UPGRADE(4, "应用升级"),
    APP_UNINSTALL(5, "应用卸载"),
    CONFIG_PUSH(6, "配置推送"),
    CONFIG_UPDATE(7, "配置更新"),
    EMERGENCY_NOTICE(8, "紧急通知"),
    OTHER(9, "其他");

    private final Integer code;
    private final String name;

    TaskTypeEnum(Integer code, String name) {
        this.code = code;
        this.name = name;
    }

    public static String getNameByCode(Integer code) {
        if (code == null) return "未知类型";
        for (TaskTypeEnum value : values()) {
            if (value.getCode().equals(code)) {
                return value.getName();
            }
        }
        return "未知类型";
    }
}